package com.demo.simple;

import java.util.Scanner;

/**
 * @author wangning
 * @date 2023/10/20 20:12
 * 回文：palindrome
 * 给一个整数，判断是否是回文，例如 121 是回文，123 不是回文
 */
public class Palindrome {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入一个整数：");
        int number = scanner.nextInt();
        palindrome01(number);

    }

    /**
     *
     */
    public static void palindrome01(int num) {
        int temp = num;
        int x = 0;
        while (num != 0) {
            int g = num % 10;
            num = num / 10;
            x = x * 10 + g;
        }
        System.out.println("x = " + x);
        System.out.println(x == temp);
    }
}
